From: Giovanni Campagna Date: Thu, 13 Feb 2014 14:11:07 +0000 (+0100) Subject: Magnifier: fix a warning when calling setActive() with the same value X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2800 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3b0197620fcd98de9be79f5245ca1079033563ee;p=gnome-shell.git Magnifier: fix a warning when calling setActive() with the same value We must not call enable/disable_unredirect if we didn't change the active value, otherwise mutter gets confused and emits warnings. https://bugzilla.gnome.org/show_bug.cgi?id=724293 --- diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 96c12b22e..81e3553a4 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -105,17 +105,20 @@ const Magnifier = new Lang.Class({ * @activate: Boolean to activate or de-activate the magnifier. */ setActive: function(activate) { + let isActive = this.isActive(); + this._zoomRegions.forEach (function(zoomRegion, index, array) { zoomRegion.setActive(activate); }); - if (activate) { - Meta.disable_unredirect_for_screen(global.screen); - this.startTrackingMouse(); - } - else { - Meta.enable_unredirect_for_screen(global.screen); - this.stopTrackingMouse(); + if (isActive != activate) { + if (activate) { + Meta.disable_unredirect_for_screen(global.screen); + this.startTrackingMouse(); + } else { + Meta.enable_unredirect_for_screen(global.screen); + this.stopTrackingMouse(); + } } // Make sure system mouse pointer is shown when all zoom regions are